#!/usr/bin/python

if __name__=="__main__":

	#ptions, action, command, keys = parse_options(sys.argv[1:])
	#process_command(options, action, command, keys, URLCONNECT)


	url_connect = URLCONNECT

	#Create requistion
	action = 'add'
	options = {}
	options['source'] = "TWiO"
	process_command(options, action, 'requisition', {}, URLCONNECT)

	#sys.exit()	

	#Create Node
	action = 'add'
	options = {}
	options['source'] = "TWiO"
	options['id'] = 'foreignid1'
	options['node-label'] = 'MIA-DVR1'
	keys = {'building': 'Miami'}
	process_command(options, action, 'node', {}, URLCONNECT)

	#set Node Attribute	
	action = 'set'
	keys = {'building': 'Miami'}
	process_command(options, action, 'node', keys, URLCONNECT)
	
	#Add Interface
	# add remove set
	action = 'add'
	options = {}
	options['source'] = "TWiO"
	options['ip'] = '10.80.4.5'
	options['id'] = 'foreignid1'
	process_command(options, action, 'interface', {}, URLCONNECT)

	#set Interface keys	
	action = 'set'
	keys = {'descr':'Interface 1'}
	process_command(options, action, 'interface', keys, URLCONNECT)

	#Add Category
	# add remove set
	action = 'add'
	options = {}
	options['source'] = "TWiO"
	options['category'] = 'Security'
	options['id'] = 'foreignid1'
	process_command(options, action, 'category', {}, URLCONNECT)
	
	#Add Category
	# add remove set
	action = 'remove'
	options = {}
	options['source'] = "TWiO"
	options['category'] = 'Security'
	options['id'] = 'foreignid1'
	process_command(options, action, 'category', {}, URLCONNECT)
	
	#Add Service
	# add remove set
	action = 'add'
	options = {}
	options['source'] = "TWiO"
	options['ip'] = '10.80.4.5'
	options['id'] = 'foreignid1'
	options['service'] = 'ICMP'
	process_command(options, action, 'service', {}, URLCONNECT)
	

	#Create Node
	action = 'add'
	options = {}
	options['source'] = "TWiO"
	options['id'] = 'foreignid2'
	options['node-label'] = 'MIA-Panel1'
	keys = {'building': 'Miami'}
	process_command(options, action, 'node', {}, URLCONNECT)

	#set Node Attribute	
	action = 'set'
	keys = {'building': 'Miami'}
	process_command(options, action, 'node', keys, URLCONNECT)
	
	#Add Interface
	# add remove set
	action = 'add'
	options = {}
	options['source'] = "TWiO"
	options['ip'] = '10.80.4.9'
	options['id'] = 'foreignid2'
	process_command(options, action, 'interface', {}, URLCONNECT)

	action = 'set'
	keys = {'descr':'Interface 1'}
	process_command(options, action, 'interface', keys, URLCONNECT)

	#Add Service
	# add remove set
	action = 'add'
	options = {}
	options['source'] = "TWiO"
	options['ip'] = '10.80.4.9'
	options['id'] = 'foreignid2'
	options['service'] = 'ICMP'
	process_command(options, action, 'service', {}, URLCONNECT)
	

	#Create Node
	action = 'add'
	options = { 'source': "TWiO", 'id':'foreignid3', 'node-label' : 'MIA-CAMERA1' }
	keys = {'building': 'Miami'}
	process_command(options, action, 'node', {}, URLCONNECT)


	#set Node Attribute	
	action = 'set'
	keys = {'building': 'Miami'}
	process_command(options, action, 'node', keys, URLCONNECT)
	
	#Add Interface
	# add remove set
	action = 'add'
	options = {}
	options['source'] = "TWiO"
	options['ip'] = '10.80.4.13'
	options['id'] = 'foreignid3'
	process_command(options, action, 'interface', {}, URLCONNECT)

	action = 'set'
	keys = {'descr':'Interface 1'}
	process_command(options, action, 'interface', keys, URLCONNECT)

	#Add Service
	# add remove set
	action = 'add'
	options = {}
	options['source'] = "TWiO"
	options['ip'] = '10.80.4.13'
	options['id'] = 'foreignid3'
	options['service'] = 'ICMP'
	process_command(options, action, 'service', {}, URLCONNECT)
	


#!/usr/bin/python

import sys
sys.path.append('../')
import onmsprovision

OPTIONS = {'source' : "TWiO", 'id' : 'foreignid1', 'node-label' : 'MIA-DVR1'}
KEYS = {'building': 'Miami'}

 def add_node():
	#Create Node
	action = 'add'
	onmsprovision.process_command(OPTIONS, action, 'node', {}, onmsprovision.URLCONNECT)

def set_node_attributes():
	#set Node Attribute	
	action = 'set'
	onmsprovision.process_command(OPTIONS, action, 'node', KEYS, onmsprovision.URLCONNECT)

def delete_node():
	action = remove
	onmsprovision.process_command(OPTIONS, action, 'node', {}, onmsprovision.URLCONNECT)

if __name__=="__main__":


	add_node()
	set_node_attributes()
	
